package com.itheima.d6_object_stream;

import java.io.*;

/*
  目标：掌握对象字节输出流的使用：序列化对象。
 */
public class Test1ObjectOutputStream {
    public static void main(String[] args) throws Exception {
        ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream("aaa.txt"));
        oos.writeObject(new Student("李白","李太白","将进酒"));
        oos.writeObject(new Student("鲁班","哈哈","尼玛"));



        oos.close();

    }

}

class Student implements Serializable{
    @Serial
    private static final long serialVersionUID = 7614182286089393626L;
    private String name;
    private transient String password;

    public Student(String name, String password, String nickName) {
        this.name = name;
        this.password = password;
        this.nickName = nickName;
    }

    private String nickName;

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public Student(String name, String password) {
        this.name = name;
        this.password = password;
    }

    public Student() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}
